home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / bbsutils / pb_200.arj / PB200SDK.DOC < prev    next >
Text File  |  1994-02-01  |  63KB  |  1,890 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.       ▒▒▒▒▒▒▒▒▒▄                 ▒▒▒▒▒▒▒▒▒▄
  22.        ▒▒█▀▀▀▒▒█                  ▒▒█▀▀▀▒▒█
  23.        ▒▒█   ▒▒█ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▄  ▒▒█   ▒▒█ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▄ ▒▒▒▒▒▒▒▄
  24.        ▒▒▒▒▒▒▒▒█ ▒▒█▀▒▒█ ▒▒█▀▒▒█  ▒▒▒▒▒▒▒█▀ ▒▒█▀▒▒█ ▒▒█▀▒▒█ ▒▒█▀▒▒█  ▒▒█▀▒▒█
  25.        ▒▒█▀▀▀▀▀▀ ▒▒▒▒▒▒█ ▒▒█ ▒▒█  ▒▒█▀▀▀▒▒█ ▒▒█ ▒▒█ ▒▒▒▒▒▒█ ▒▒▒▒▒▒█  ▒▒█ ▒▒█
  26.        ▒▒█       ▒▒█▒▒█▀ ▒▒█ ▒▒█  ▒▒█   ▒▒█ ▒▒█ ▒▒█ ▒▒█▀▒▒█ ▒▒█▒▒█▀  ▒▒█ ▒▒█
  27.       ▒▒▒▒█      ▒▒█ ▒▒█ ▒▒▒▒▒▒█ ▒▒▒▒▒▒▒▒▒█ ▒▒▒▒▒▒█ ▒▒█ ▒▒█ ▒▒█ ▒▒█ ▒▒▒▒▒▒▒█
  28.        ▀▀▀▀       ▀▀  ▀▀  ▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀  ▀▀  ▀▀  ▀▀  ▀▀  ▀▀▀▀▀▀▀
  29.  
  30.                            "The Choice of Professionals"
  31.  
  32.  
  33.                              Software Developer's Kit
  34.                                    Version 2.00
  35.  
  36.                              ++ February 1st , 1993 ++
  37.  
  38.  
  39.                    Copyright (c) 1990-1993 Philippe Leybaert
  40.                               All rights reserved
  41.  
  42.  
  43.  
  44.         ╒══════════════════════════════════════════════════════════════════╕
  45.         │░░░░░░░░ PROBOARD SOFTWARE DEVELOPMENT KIT VERSION 2.00 ░░░░░░░░░░│
  46.         ╘══════════════════════════════════════════════════════════════════╛
  47.  
  48.  
  49.          Included with ProBoard is a C library that allows you to write
  50.          your own extensions to ProBoard in C or C++. All you need is an
  51.          ANSI-compatible C or C++ compiler. The programs you create can be
  52.          run within ProBoard by executing a new menu function.
  53.  
  54.          The ProBoard SDK files included with ProBoard are free software,
  55.          so anyone who does not use ProBoard to run a BBS on a regular
  56.          basis, but wants to write extension files, is allowed to do so
  57.          without registering ProBoard. You can distribute any ProBoard
  58.          extension files (PEX files) royalty-free. As far as we are
  59.          concerned, any program you develop with the ProBoard SDK is your
  60.          property.
  61.  
  62.  
  63.  
  64.         ┌──────────────────────────────────────────────────────────────────┐
  65.         │ Requirements                                                     │
  66.         └──────────────────────────────────────────────────────────────────┘
  67.  
  68.          To create your own programs you need:
  69.  
  70.          - An ANSI compatible C or C++ compiler. Compilers known to be
  71.            compatible with the ProBoard SDK are:
  72.  
  73.               - Zortech C/C++ 2.0 - 3.0
  74.               - Microsoft C/C++ 5.1 - 7.0
  75.               - Borland C++ 2.0 - 3.1
  76.               - Turbo C++ 1.0
  77.               - Turbo C 1.0 - 2.0
  78.  
  79.            Other compilers may work too, but were not tested.
  80.  
  81.          - An MS-compatible linker (usually the one that came with your
  82.            compiler).
  83.  
  84.            Linkers known to work with the ProBoard SDK are:
  85.  
  86.               - All Microsoft Linkers (LINK.EXE)
  87.               - Borland's Turbo Link (TLINK)
  88.               - Zortech's BLINK
  89.  
  90.          - The ProBoard SDK include file PB_SDK.H
  91.  
  92.          - The ProBoard SDK library PB_SDK.LIB (for non-Borland compilers)
  93.          - The ProBoard SDK file PB_SDK.OBJ (for Borland 3.x compilers)
  94.  
  95.  
  96.                                       - 1 -
  97.  
  98.  
  99.  
  100.         ┌──────────────────────────────────────────────────────────────────┐
  101.         │ Creating ProBoard Executables (PEX-files)                        │
  102.         └──────────────────────────────────────────────────────────────────┘
  103.  
  104.          To create your own ProBoard executable (.PEX file), you first
  105.          create a source file, say MYPROG.C. When ProBoard loads a PEX
  106.          file, it executes the function main() in your program. This
  107.          function is defined as:
  108.  
  109.          void
  110.          main(int argc,char *argv[])
  111.          {
  112.           ...
  113.          }
  114.  
  115.          The parameters 'argc' & 'argv' contain optional data that can be
  116.          given to your program at load time (exactly like C's argc and argv
  117.          parameters).  Creating this main() function is the only thing you
  118.          need to do to write a valid ProBoard executable. From this point
  119.          on, it's just like writing a regular C program.  Most of the ANSI
  120.          standard library functions are available, plus many ProBoard-
  121.          specific functions and global variables, used for interfacing
  122.          between your program and the ProBoard environment.  As in a regular
  123.          executable, you can build your program from several source files.
  124.  
  125.          This is a tiny sample ProBoard program:
  126.  
  127.          #include "pb_sdk.h"
  128.  
  129.          void
  130.          main()
  131.          {
  132.           printf("You have %d minutes left.\n",TimeLeft());
  133.  
  134.           AddTime(10);
  135.  
  136.           printf("Now you have %d minutes left.\n",TimeLeft());
  137.          }
  138.  
  139.  
  140.          Included with ProBoard are a few example programs (in source form
  141.          of course).
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.                                       - 2 -
  153.  
  154.  
  155.  
  156.         ┌──────────────────────────────────────────────────────────────────┐
  157.         │ Compiling and Linking                                            │
  158.         └──────────────────────────────────────────────────────────────────┘
  159.  
  160.          ProBoard executables have to be compiled using the LARGE memory
  161.          model.
  162.  
  163.          For example (Turbo C++) : tcc -c -ml myprog.c
  164.  
  165.          Once you have your .OBJ file (in this case MYPROG.OBJ), you have
  166.          to link it with the ProBoard SDK library (PB_SDK.LIB). You have to
  167.          specify a filename as output filename. The linked executable must
  168.          have extension .PEX. It is important to disable linking of the
  169.          default compiler libraries!! It is also required to turn on
  170.          case sensitivity.
  171.  
  172.          e.g.   Turbo C++ :  TLINK MYPROG,MYPROG.PEX,,PB_SDK /N /C
  173.                 Microsoft :  LINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  174.                 Zortech   :  BLINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  175.  
  176.          That's all there is to it. Now you can run your program through
  177.          ProBoard's menu function 60.
  178.  
  179.          I will now give the compiler syntax for some popular compilers:
  180.  
  181.           Zortech C/C++ : ztc -c -a -ml myprog.c
  182.           Microsoft C   : cl -Zep -Gs -c -AL myprog.c
  183.           Turbo C/C++   : tcc -c -ml myprog.c
  184.           Borland C++   : bcc -c -ml myprog.c
  185.  
  186.          And linker syntax:
  187.  
  188.           Borland       : TLINK PB_SDK MYPROG,MYPROG.PEX /N /C
  189.           Microsoft     : LINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  190.           Zortech       : BLINK MYPROG,MYPROG.PEX,,PB_SDK /NOD /NOI;
  191.  
  192.          Note that the syntax for Borland C++ has changed from the previous
  193.          versions of the SDK. It is required that you specify PB_SDK.OBJ
  194.          BEFORE your object files, and don't link PB_SDK.LIB.
  195.  
  196.  
  197.  
  198.         ┌──────────────────────────────────────────────────────────────────┐
  199.         │ Restrictions                                                     │
  200.         └──────────────────────────────────────────────────────────────────┘
  201.  
  202.          There are few restrictions in writing ProBoard executables. For C
  203.          programs there are actually only two major restriction: long math
  204.          & floating point operations.
  205.  
  206.  
  207.  
  208.                                       - 3 -
  209.  
  210.  
  211.  
  212.          Due to the fact that all compilers generate function calls to
  213.          multiply, divide and shift long integers, and that every compiler
  214.          vendor uses its own array of functions, it is impossible to
  215.          include these functions in the ProBoard SDK. As a result, it is
  216.          not directly possible to perform these operations on long values
  217.          (eg. long1 = long2 * long3). However, we did include functions to
  218.          perform these operations, but you will have to call these
  219.          functions explicitly (eg. long1 = l_mul(long2,long3)).  People who
  220.          know their compiler well, can work around this problem by
  221.          extracting the long math functions from the standard library, and
  222.          linking them with the PEX file. For example, the long math
  223.          functions used by the Zortech compiler are in the module
  224.          LMATH.OBJ, located in the library ZLC.LIB. Extracting this module
  225.          is as simple as :  ZORLIB ZLS *LMATH;
  226.  
  227.          These are the ProBoard long math functions that you can use:
  228.  
  229.          long l_mul(long1,long2)   Multiply 2 long values   = long1 * long2
  230.          long l_div(long1,long2)   Divide 2 long values     = long1 / long2
  231.          long l_mod(long1,long2)   Modulo of 2 long values  = long1 % long2
  232.          long l_shl(long1,int1)    Left shift a long value  = long1 << int1
  233.          long l_shr(long1,int1)    Right shift a long value = long1 >> int1
  234.  
  235.          The functions l_div(), l_mod(), l_shl() and l_shr() are also
  236.          available for unsigned long values: ul_div(), ul_mod(), ul_shl()
  237.          and ul_shr().
  238.  
  239.          Floating point operations are NOT supported. So it is not possible
  240.          to use 'double' and 'float' variables & constants.
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.                                       - 4 -
  265.  
  266.  
  267.  
  268.          Another major restriction only affects C++ programs that are
  269.          compiled with some other compiler than Borland C/C++ 3.x or
  270.          Zortech C++ 3.0.  In a ProBoard C++ program that is not compiled
  271.          with one of the compilers mentioned, you can't declare global
  272.          variables that have constructors or destructors (ie. no static
  273.          constructors & destructors). So this will compile fine, but will
  274.          certainly crash your machine:
  275.  
  276.          class myclass
  277.             {
  278.                 int a;
  279.             public:
  280.                 x() { .... some action .... }
  281.                ~x() { .... some action .... }
  282.             };
  283.  
  284.          myclass some_global_object;
  285.  
  286.          main()
  287.          {
  288.          ...
  289.          }
  290.  
  291.          You can, however, use objects with constructors and destructors,
  292.          as long as they are declared within a function. So this would
  293.          work:
  294.  
  295.          main()
  296.          {
  297.           myclass some_local_object;
  298.           ....
  299.          }
  300.  
  301.  
  302.  
  303.         ┌──────────────────────────────────────────────────────────────────┐
  304.         │ Library functions supported                                      │
  305.         └──────────────────────────────────────────────────────────────────┘
  306.  
  307.          Almost all standard library functions are supported. Note that all
  308.          functions that write to the standard output device (printf,
  309.          putchar,...) write their output to the ProBoard window and to the
  310.          user (through the modem).  Functions that read from the standard
  311.          input device and from the keyboard are NOT supported.
  312.          (scanf,getch,gets,...) We provide substitutes for these functions.
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.                                       - 5 -
  321.  
  322.  
  323.  
  324.          Functions supported:
  325.  
  326.               fopen , freopen , fseek , ftell , fgets , fgetc , fflush
  327.               fclose , fputs , getc , getchar , gets , fputc , putc ,
  328.               putchar , puts , fread , fwrite , printf , fprintf ,
  329.               vfprintf , vprintf , sprintf , vsprintf , setbuf ,
  330.               setvbuf , remove , rename , rewind , clearerr , feof ,
  331.               isalpha , iscntrl , isdigit , isgraph , islower ,
  332.               isprint , ispunct , isspace , isupper , isxdigit ,
  333.               toupper , tolower , int86x , intdos , intdosx ,
  334.               dos_findfirst , dos_findnext , write , open , creat ,
  335.               close , unlink , chsize , dup , dup2 , lseek , access ,
  336.               filesize , filelength , isatty , atoi , atol , strtol ,
  337.               rand , srand , calloc , free , malloc , realloc , putenv
  338.               getenv , abs , labs , memcpy , memmove , strcpy , strncpy ,
  339.               strcat , strncat , memcmp , strcmp , strncmp , memchr ,
  340.               strchr , strcspn , strpbrk , strrchr , strspn , strstr ,
  341.               strtok , memset , strlen , memicmp , stpcpy , strcmpl ,
  342.               strnicmp , strdup , strlwr , strupr , strnset , strrev ,
  343.               strset , swab , strncmpl , strnicmp , clock , time , mktime ,
  344.               asctime , ctime , localtime , gmtime , strftime , sleep ,
  345.               usleep , msleep , difftime
  346.  
  347.  
  348.          For information on these functions, consult your compiler's
  349.          library reference manual.
  350.  
  351.          In the string output functions (printf and puts), you can use the
  352.          following control codes in your string:
  353.  
  354.          \001 or \x01   Set output color to red
  355.          ::::    ::::
  356.          ::::    ::::
  357.          \007 or \x07   Set output color to white
  358.  
  359.          \x11 to \x17   Same as \1 to \7, but blinking colors
  360.  
  361.          \t             Stops output of string until user presses [Enter]
  362.          \f             Clears the user's screen (if enabled in the user's
  363.                         record)
  364.  
  365.  
  366.          NOTE: Do NOT include any standard include files from your
  367.          compiler. The only include file you can use is PB_SDK.H.
  368.          THAT'S IT!!
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.                                       - 6 -
  377.  
  378.  
  379.  
  380.         ┌──────────────────────────────────────────────────────────────────┐
  381.         │ ProBoard Interface Functions                                     │
  382.         └──────────────────────────────────────────────────────────────────┘
  383.  
  384.          This is a list of all the functions that can be used to interface
  385.          with ProBoard.
  386.  
  387.          Several types have been defined in the file PB_SDK.H
  388.  
  389.            bool    : a boolean value that can have the values TRUE or FALSE
  390.            byte    : an unsigned character (8 bits)
  391.            word    : an unsigned short integer (16 bits)
  392.            dowrd   : an unsigned long integer (32 bits)
  393.            KEY     : used for key scan codes (for sysopkey handlers and the
  394.                      ScanKey() function).
  395.  
  396.  
  397.          ──────────────────────────────────────────────────────────────────
  398.          void AddTime(int min);
  399.          ──────────────────────────────────────────────────────────────────
  400.  
  401.          Adds 'min' minutes to the user's time left. If 'min' is negative,
  402.          the number of minutes will be subtracted from the time left.
  403.  
  404.          Examples:    AddTime(10);         /* Adds 10 minutes */
  405.                       AddTime(-5);         /* Subtracts 5 minutes */
  406.  
  407.  
  408.  
  409.          ──────────────────────────────────────────────────────────────────
  410.          int TimeLeft(void);
  411.          ──────────────────────────────────────────────────────────────────
  412.  
  413.          Returns the time left in minutes for the current user.
  414.  
  415.  
  416.  
  417.          ──────────────────────────────────────────────────────────────────
  418.          int TimeOnline(void);
  419.          ──────────────────────────────────────────────────────────────────
  420.  
  421.          Returns the time in minutes that the current user is online.
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.                                       - 7 -
  433.  
  434.  
  435.  
  436.          ──────────────────────────────────────────────────────────────────
  437.          void SuspendTimer(void);
  438.          ──────────────────────────────────────────────────────────────────
  439.  
  440.          Suspends the online-timer for the current user. No time will be
  441.          subtracted until RestartTimer() is called.
  442.  
  443.  
  444.  
  445.          ──────────────────────────────────────────────────────────────────
  446.          void RestartTimer(void);
  447.          ──────────────────────────────────────────────────────────────────
  448.  
  449.          Restarts the timer after a call to SuspendTimer().
  450.  
  451.  
  452.  
  453.          ──────────────────────────────────────────────────────────────────
  454.          void AdjustTime(void);
  455.          ──────────────────────────────────────────────────────────────────
  456.  
  457.          Call this function if you changed the user's level. This
  458.          recalculates all limits (time,download,...).
  459.  
  460.  
  461.  
  462.          ──────────────────────────────────────────────────────────────────
  463.          void MsgEd(void);
  464.          ──────────────────────────────────────────────────────────────────
  465.  
  466.          Fires up the internal message editor or the fullscreen editor,
  467.          depending on the settings of the user. The message will be stored
  468.          in the file MSGTMP in the current directory. If a message is
  469.          aborted, the file MSGTMP will be deleted by the message editor.
  470.          If you create a MSGTMP file before invoking the message editor,
  471.          this file will be used as a 'quote' message.
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.                                       - 8 -
  489.  
  490.  
  491.  
  492.          ──────────────────────────────────────────────────────────────────
  493.          int PostMessage(char *from,char *to,char *subject,int area,
  494.                          bool pvt);
  495.          ──────────────────────────────────────────────────────────────────
  496.  
  497.          Posts a message to a user.
  498.  
  499.             from    = Name of the sender
  500.             to      = Name of the user you're sending the message to
  501.             subject = Subject of the message
  502.             area    = Message area number where the message has to
  503.                       be posted in.
  504.             pvt     = Private status (TRUE=private, FALSE=public)
  505.  
  506.          No checking is performed on any of the parameters!
  507.  
  508.  
  509.          Return value: -1 on error
  510.                         0 if ok
  511.  
  512.  
  513.  
  514.          ──────────────────────────────────────────────────────────────────
  515.          int PostNetmail(char *from,char *to,char *subject,int area,
  516.                          FIDO_NODE *address,bool attach,bool crash,
  517.                          bool kill);
  518.          ──────────────────────────────────────────────────────────────────
  519.  
  520.          Posts a netmail message.
  521.  
  522.             from    = Name of the sender
  523.             to      = Name of the user you're sending the message to
  524.             subject = Subject of the message
  525.             area    = Message area number where the message has to
  526.                       be posted in
  527.             address = Destination node number of this message.
  528.             attach  = TRUE for a file attach message
  529.             crash   = TRUE if this message is a crashmail message
  530.             kill    = TRUE if the message has to be deleted after it is
  531.                       sent
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.                                       - 9 -
  545.  
  546.  
  547.  
  548.          FIDO_NODE is a structure with the following fields:
  549.  
  550.            struct
  551.              {
  552.               unsigned zone;  /* Zone number  */
  553.               unsigned net;   /* Net number   */
  554.               unsigned node;  /* Node number  */
  555.               unsigned point; /* Point number */
  556.              }
  557.  
  558.          No checking is performed on any of the parameters!
  559.  
  560.          Return value: -1 on error
  561.                         0 if ok
  562.  
  563.  
  564.  
  565.          ──────────────────────────────────────────────────────────────────
  566.          bool ReadMsgArea(int area,MSGAREA *ma);
  567.          ──────────────────────────────────────────────────────────────────
  568.  
  569.          Reads data about a message area.
  570.  
  571.               area  = Message area number (1-200)
  572.               ma    = Pointer to a MSGAREA structure to be filled
  573.  
  574.          Check the file PB_SDK.H for details about the MSGAREA structure
  575.          definition.
  576.  
  577.          Return value:  FALSE if not defined
  578.                         TRUE  if read ok
  579.  
  580.  
  581.  
  582.          ──────────────────────────────────────────────────────────────────
  583.          bool ReadMessage(MESSAGE *msg,int msgnum);
  584.          ──────────────────────────────────────────────────────────────────
  585.  
  586.          Reads message id <msgid> into the MESSAGE structure. To access the
  587.          text of the message, use the function CreateMessageText().
  588.          See the file PB_SDK.H for a description of the MESSAGE structure.
  589.  
  590.          Return value: FALSE if the message does not exists
  591.                        TRUE  if the message is read ok
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.                                       - 10 -
  601.  
  602.  
  603.  
  604.          ──────────────────────────────────────────────────────────────────
  605.          void WriteMSGTMP(char *text);
  606.          ──────────────────────────────────────────────────────────────────
  607.  
  608.          Writes the string <text> to the file MSGTMP. The file is always
  609.          recreated when using this function. To append text to MSGTMP,
  610.          use the function AppendMSGTMP(). You have to insert your own CR/LF
  611.          pairs in the text if you want to force a newline.  Lines can be
  612.          longer than 80 characters.  The message processing functions will
  613.          do a word-wrap if necessary.  Do NOT insert a single CR or LF in
  614.          the text. (\r or \n).
  615.  
  616.  
  617.  
  618.          ──────────────────────────────────────────────────────────────────
  619.          void AppendMSGTMP(char *text);
  620.          ──────────────────────────────────────────────────────────────────
  621.  
  622.          Same as WriteMSGTMP(), but adds text to an EXISTING file.
  623.  
  624.  
  625.  
  626.          ──────────────────────────────────────────────────────────────────
  627.          void ShowMessage(MESSAGE *msg);
  628.          ──────────────────────────────────────────────────────────────────
  629.  
  630.          Shows the message <msg> to the user, including header and message
  631.          text.
  632.          See the file PB_SDK.H for an description of the MESSAGE structure.
  633.  
  634.  
  635.  
  636.          ──────────────────────────────────────────────────────────────────
  637.          void CreateMessageText(MESSAGE *msg);
  638.          ──────────────────────────────────────────────────────────────────
  639.  
  640.          Reads the text that belongs to message <msg>, and stores it in a
  641.          file called MSGTMP in the current directory. This file can then be
  642.          accessed as an ordinary textfile.
  643.  
  644.  
  645.  
  646.          ──────────────────────────────────────────────────────────────────
  647.          void CreateMessageTextString(MESSAGE *msg,char *text,int max);
  648.          ──────────────────────────────────────────────────────────────────
  649.  
  650.          Reads the text that belongs to message <msg>, and stores it in the
  651.          string <text>. The text will be terminated by a '\0' character.
  652.          You have to specify a maximum number of characters that can be
  653.          stored in <text>.
  654.  
  655.  
  656.                                       - 11 -
  657.  
  658.  
  659.  
  660.          ──────────────────────────────────────────────────────────────────
  661.          bool FirstMessage(MESSAGE *msg,int area,int order,long first);
  662.          bool NextMessage(MESSAGE *msg,int area,int order);
  663.          ──────────────────────────────────────────────────────────────────
  664.  
  665.          These functions are used to read messages in forward or reverse
  666.          order. To start scanning messages, you have to call the
  667.          FirstMessage() function first, and the NextMessage() function to
  668.          read more messages.
  669.  
  670.          msg   = MESSAGE structure where the message has to be stored.
  671.          area  = area number to read messages in (0 = all areas)
  672.          order = 1 for forward order, -1 for reverse order
  673.          first = message to start reading from. This message does NOT
  674.                  need to exist. The first non-deleted message following
  675.                  this message will be read first.
  676.  
  677.          See the file PB_SDK.H for an description of the MESSAGE structure.
  678.  
  679.          Return value: FALSE  No more messages found.
  680.                        TRUE   Message was found and read ok.
  681.  
  682.  
  683.          This is an example on how to use these functions:
  684.  
  685.          result = FirstMessage(msg,0,+1,1);
  686.          while(result == TRUE)
  687.            {
  688.             /* Do something with the message */
  689.             result = NextMessage(msg,0,+1);
  690.            }
  691.  
  692.  
  693.  
  694.          ──────────────────────────────────────────────────────────────────
  695.          void DeleteMessage(MESSAGE *msg);
  696.          ──────────────────────────────────────────────────────────────────
  697.  
  698.          Deletes message <msg>.
  699.  
  700.  
  701.  
  702.          ──────────────────────────────────────────────────────────────────
  703.          void MarkMessage(long msgid);
  704.          ──────────────────────────────────────────────────────────────────
  705.  
  706.          Marks message <msgid> for later retrieval. Up to 200 messages can
  707.          be marked.
  708.  
  709.  
  710.  
  711.  
  712.                                       - 12 -
  713.  
  714.  
  715.  
  716.          ──────────────────────────────────────────────────────────────────
  717.          void ReadMarkedMessages(void);
  718.          ──────────────────────────────────────────────────────────────────
  719.  
  720.          Shows all marked messages to the user, with the option to wait
  721.          after each message. If the user selected to wait after each
  722.          message, the standard message options menu will be shown to the
  723.          user. (Next,Prev,Stop,...).
  724.          In fact, this function is identical to menu function "Read
  725.          Messages", with the user selecting "Marked".
  726.  
  727.  
  728.  
  729.          ──────────────────────────────────────────────────────────────────
  730.          void ListMarkedMessages(void);
  731.          ──────────────────────────────────────────────────────────────────
  732.  
  733.          Is similar to ReadMarkedMessages(), but this function acts as a
  734.          "QuickScan Messages" with the user selecting "Marked".
  735.  
  736.  
  737.  
  738.          ──────────────────────────────────────────────────────────────────
  739.          void UnMarkAllMessages(void);
  740.          ──────────────────────────────────────────────────────────────────
  741.  
  742.          Unmarks all messages that were previously marked. You have to call
  743.          this function before marking any messages, because the list of
  744.          marked messages is remembered until a user logs off.
  745.  
  746.  
  747.  
  748.          ──────────────────────────────────────────────────────────────────
  749.          int NumMsgAreas(void);
  750.          ──────────────────────────────────────────────────────────────────
  751.  
  752.          Returns the highest message area number that is not empty.
  753.  
  754.  
  755.  
  756.          ──────────────────────────────────────────────────────────────────
  757.          long GetLastRead(int areanum , long user_recno);
  758.          void SetLastRead(int areanum , long user_recno , long msgid);
  759.          ──────────────────────────────────────────────────────────────────
  760.  
  761.          Reads / Sets the lastread pointer for a specific user and message
  762.          area.  If GetLastRead() returns -1, an error occurred.
  763.  
  764.  
  765.  
  766.  
  767.  
  768.                                       - 13 -
  769.  
  770.  
  771.  
  772.          <areanum> ..... The area number (1-10000)
  773.          <user_recno> .. The record number of the user (0 - ...)
  774.          <msgnum> ...... The id of the message you want to set the
  775.                          lastread pointer to.
  776.  
  777.  
  778.  
  779.          ──────────────────────────────────────────────────────────────────
  780.          int FuzzySearch(char *text,char *string,int degree);
  781.          ──────────────────────────────────────────────────────────────────
  782.  
  783.          Performs a fuzzy search for <string> in <text>. <degree> is the
  784.          percentage of the characters in <string> that have to match.
  785.  
  786.          Return value: -1 if not found
  787.                        >0 percentage of characters matched
  788.  
  789.  
  790.  
  791.          ──────────────────────────────────────────────────────────────────
  792.          IO_... functions
  793.          ──────────────────────────────────────────────────────────────────
  794.  
  795.          All functions starting with IO_ are low-level functions to access
  796.          the serial port directly. Do NOT use these functions for ordinary
  797.          I/O operations. They are intended for writing file transfer
  798.          protocols. See the file PB_SDK.H for a description of these
  799.          functions.
  800.  
  801.  
  802.  
  803.          ──────────────────────────────────────────────────────────────────
  804.          char WaitKey(void);
  805.          ──────────────────────────────────────────────────────────────────
  806.  
  807.          Waits for a character to be read from the modem or local keyboard.
  808.  
  809.          Return value: the character read.
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.                                       - 14 -
  825.  
  826.  
  827.  
  828.          ──────────────────────────────────────────────────────────────────
  829.          char WaitKeys(char *keylist);
  830.          ──────────────────────────────────────────────────────────────────
  831.  
  832.          Waits for any character specified in <keylist>.
  833.  
  834.          Return value: the key from the list that was pressed (converted to
  835.                        uppercase if the key is a letter).
  836.  
  837.          Example : c = WaitKeys("ABC\r\x1b");
  838.                    /* Waits for A,B,C,<Enter> or <Esc> */
  839.  
  840.  
  841.  
  842.          ──────────────────────────────────────────────────────────────────
  843.          void Input(char *buf,int len,int readmode);
  844.          ──────────────────────────────────────────────────────────────────
  845.  
  846.          Asks for a string from the user. The string is stored in <buf>,
  847.          and the user will not be allowed to enter more than <len>
  848.          characters.
  849.  
  850.          <readmode> :  INPUT_ALL      : All characters are allowed
  851.                        INPUT_UPFIRST  : First character of each word is
  852.                                         converted to uppercase.
  853.                        INPUT_UPALL    : All characters are converted to
  854.                                         uppercase.
  855.                        INPUT_DIGITS   : Only digits are accepted.
  856.  
  857.                        INPUT_NOFIELD  : OR together with any of the
  858.                                         previous modes if you don't want an
  859.                                         input-field background to be
  860.                                         displayed.
  861.  
  862.  
  863.  
  864.          ──────────────────────────────────────────────────────────────────
  865.          bool Ask(bool default);
  866.          ──────────────────────────────────────────────────────────────────
  867.  
  868.          Asks for a Yes or No response from the user. Pressing 'Y' returns
  869.          TRUE and outputs "Yes". Pressing 'N' returns FALSE and sends "No"
  870.          to the user. Pressing <Enter> returns <default>, and sends "Yes"
  871.          or "No", depending on <default>.
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.                                       - 15 -
  881.  
  882.  
  883.  
  884.          ──────────────────────────────────────────────────────────────────
  885.          char PeekChar(void);
  886.          ──────────────────────────────────────────────────────────────────
  887.  
  888.          Checks if a character is available in the input buffer, and
  889.          returns that character if there is.
  890.  
  891.          Return value:     0 if no character available
  892.                         != 0 the character read (key pressed by user)
  893.  
  894.  
  895.  
  896.          ──────────────────────────────────────────────────────────────────
  897.          void SetColor(char color);
  898.          ──────────────────────────────────────────────────────────────────
  899.  
  900.          Changes the current output color. All text that is output after
  901.          this function is called will be displayed in the specified color.
  902.          This function does nothing when the user does not have ANSI or
  903.          AVATAR enabled.
  904.  
  905.          <color> can be one of the following:
  906.  
  907.             BLACK , RED , GREEN , YELLOW , MAGENTA , BLUE , CYAN , WHITE
  908.  
  909.  
  910.  
  911.          ──────────────────────────────────────────────────────────────────
  912.          void SetfullColor(unsigned char color);
  913.          ──────────────────────────────────────────────────────────────────
  914.  
  915.          Changes the current foreground & background color. The color code
  916.          is an IBM-type screen color code. This function does nothing when
  917.          the user does not have ANSI or AVATAR enabled.
  918.  
  919.          Some examples:
  920.  
  921.              0x1E : Bright yellow on dark blue background.
  922.              0x87 : Blinking white on a black background.
  923.  
  924.  
  925.  
  926.          ──────────────────────────────────────────────────────────────────
  927.          void GotoXY(int x,int y);
  928.          ──────────────────────────────────────────────────────────────────
  929.  
  930.          Moves the cursor to position (x,y). The upper left corner of the
  931.          screen is (1,1). This function does nothing when the user does
  932.          not have ANSI or AVATAR enabled.
  933.  
  934.  
  935.  
  936.                                       - 16 -
  937.  
  938.  
  939.  
  940.          ──────────────────────────────────────────────────────────────────
  941.          void ClrEol();
  942.          ──────────────────────────────────────────────────────────────────
  943.  
  944.          Clears from the current cursor position to the end of the
  945.          line. This function does nothing when the user does not have ANSI
  946.          or AVATAR enabled.
  947.  
  948.  
  949.  
  950.          ──────────────────────────────────────────────────────────────────
  951.          void EnableStop(void);
  952.          void DisableStop(void);
  953.          bool Stopped(void);
  954.          ──────────────────────────────────────────────────────────────────
  955.  
  956.          Enables stopping of output by pressing 'S'. When enabled, a user
  957.          can press 'S' to stop incoming text. When this happens, any
  958.          string output function will immediately return to the caller, en
  959.          the function Stopped() will return TRUE to indicate that the user
  960.          requested to stop output.
  961.  
  962.          EnableStop()       Enables this feature and sets the "stopped"
  963.                             status to FALSE .
  964.          DisableStop()      Disables the stop feature.
  965.          Stopped()          Returns the "stopped" flag (TRUE or FALSE).
  966.  
  967.  
  968.          Example:
  969.  
  970.               EnableStop();
  971.               for(i=0;i<100;i++)
  972.                 {
  973.                  printf("...something...");
  974.                  if(Stopped()) break;
  975.                 }
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.                                       - 17 -
  993.  
  994.  
  995.  
  996.          ──────────────────────────────────────────────────────────────────
  997.          char ShowHotkeyFile(char *filename,char *hotkeys);
  998.          ──────────────────────────────────────────────────────────────────
  999.  
  1000.          Shows the file <filename> to the user, and watches for incoming
  1001.          keys that are specified in <hotkeys>. If one of these keys is
  1002.          detected, the function stops output, and returns the hotkey. The
  1003.          "stop" feature will be enabled when sending the file.
  1004.  
  1005.          Return value:    0 : File sent completely and no hotkeys pressed.
  1006.                           1 : 'S' pressed (output stopped)
  1007.                           2 : File not found
  1008.                         !=2 : Hotkey detected
  1009.  
  1010.  
  1011.  
  1012.          ──────────────────────────────────────────────────────────────────
  1013.          char ShowHotkeyANSIFile(char *filename,char *hotkeys);
  1014.          ──────────────────────────────────────────────────────────────────
  1015.  
  1016.          This function is identical to ShowKotkeyFile(), except for the
  1017.          fact that no extension and path can be specified. Depending on the
  1018.          setting of the user, <filename>.ANS/ASC in the textfiles
  1019.          directory will be sent. If no .ANS file is found, it will try to
  1020.          send the .ASC file. If that fails too, 2 will be returned.
  1021.  
  1022.          Return value:    0 : File sent completely and no hotkeys pressed.
  1023.                           1 : 'S' pressed (output stopped)
  1024.                           2 : File not found
  1025.                         !=2 : Hotkey detected
  1026.  
  1027.  
  1028.  
  1029.          ──────────────────────────────────────────────────────────────────
  1030.          void InitLineCounter(void);
  1031.          bool LineCounter(void);
  1032.          ──────────────────────────────────────────────────────────────────
  1033.  
  1034.          These functions are used to support page pausing ("More Y/N").
  1035.          Calling InitLineCounter() initializes the line counter to 0.
  1036.          Every time you call LineCounter(), the line counter is incremented
  1037.          by one. If the counter reaches the screen length, the user will be
  1038.          asked if he wants to continue reading. If he selects "No", the
  1039.          LineCounter() function will return FALSE.
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.                                       - 18 -
  1049.  
  1050.  
  1051.  
  1052.          Example:
  1053.  
  1054.              InitLineCounter();
  1055.              for(;;)
  1056.                {
  1057.                 printf("...something...\n");
  1058.                 if(!LineCounter()) break;
  1059.                }
  1060.  
  1061.  
  1062.  
  1063.          ──────────────────────────────────────────────────────────────────
  1064.          bool ExternalInput(void);
  1065.          ──────────────────────────────────────────────────────────────────
  1066.  
  1067.          Returns TRUE when the last character that was read through any of
  1068.          the input routings originated from the remote keyboard (ie. the
  1069.          sysop did not type it).
  1070.  
  1071.  
  1072.  
  1073.          ──────────────────────────────────────────────────────────────────
  1074.          int ReadUser(USER_REC *rec,int recnr);
  1075.          ──────────────────────────────────────────────────────────────────
  1076.  
  1077.          Reads user record number <recnr> (0-...) from the user file and
  1078.          stores it in <rec>.
  1079.  
  1080.          Return value:  -1 if record does not exist.
  1081.                          0 if record is read ok.
  1082.  
  1083.  
  1084.  
  1085.          ──────────────────────────────────────────────────────────────────
  1086.          void WriteUser(USER_REC *rec,int recnr);
  1087.          ──────────────────────────────────────────────────────────────────
  1088.  
  1089.          Writes user record <rec> to record number <recnr> in the userfile.
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.                                       - 19 -
  1105.  
  1106.  
  1107.  
  1108.          ──────────────────────────────────────────────────────────────────
  1109.          char PlayMusic(char *filename,char *hotkeys);
  1110.          ──────────────────────────────────────────────────────────────────
  1111.  
  1112.          Plays a .MUS file. The file has to be located in the ProBoard
  1113.          system directory. Do not include a path and extension in
  1114.          <filename>. The music can be stopped if the sysop presses one of
  1115.          the keys specified in <hotkeys>.            ^^^^^
  1116.  
  1117.          Return value:   0   Music file played till the end
  1118.                          1   Music file not found
  1119.                          >1  The hotkey pressed by the SYSOP
  1120.                                                        ^^^^^
  1121.  
  1122.  
  1123.          ──────────────────────────────────────────────────────────────────
  1124.          void PostInfo(char *filename);
  1125.          ──────────────────────────────────────────────────────────────────
  1126.  
  1127.          Does exactly the same as the POSTINFO statement in a .Q-A file.
  1128.          No path and extension is allowed in <filename>. The file where
  1129.          the information will be written to will have the extension .ASW
  1130.          and will be placed in the ProBoard system directory.
  1131.  
  1132.  
  1133.  
  1134.          ──────────────────────────────────────────────────────────────────
  1135.          int ReadFileArea(int areanum,FILEAREA *fa);
  1136.          ──────────────────────────────────────────────────────────────────
  1137.  
  1138.          Reads information about file area number <areanum> in the <fa>
  1139.          structure.
  1140.          Check the file PB_SDK.H for details about the FILEAREA structure.
  1141.  
  1142.          Return value:   -1   File area does not exist
  1143.                           0   Ok
  1144.  
  1145.  
  1146.  
  1147.          ──────────────────────────────────────────────────────────────────
  1148.          void MenuFunction(int function,char *data);
  1149.          ──────────────────────────────────────────────────────────────────
  1150.  
  1151.          Executes menu function <function> with <data>. For details, see
  1152.          the menu functions description in this file.
  1153.          There are named constants declared for each function in the file
  1154.          PB_SDK.H. It is recommended that you use these constants instead
  1155.          of numbers.
  1156.  
  1157.  
  1158.  
  1159.  
  1160.                                       - 20 -
  1161.  
  1162.  
  1163.  
  1164.          ──────────────────────────────────────────────────────────────────
  1165.          void Log(int loglevel,char *fmt,...);
  1166.          ──────────────────────────────────────────────────────────────────
  1167.  
  1168.          With this function you can write information to the ProBoard
  1169.          logfile. The log entry will be written if the user has a loglevel
  1170.          that is greater than <loglevel> .
  1171.  
  1172.          <loglevel> can be one of the following:
  1173.  
  1174.              LOG_FRIEND , LOG_NORMAL , LOG_SUSPICIOUS , LOG_DANGEROUS
  1175.  
  1176.          If you want a log entry to be written regardless of the user's
  1177.          loglevel, use LOG_FRIEND.
  1178.  
  1179.          The Log() function works like the printf function: you can use
  1180.          format specifiers in the <fmt> string, and pass extra parameters.
  1181.  
  1182.          Example:   Log(LOG_NORMAL,"User's name = %s",CurUser->name);
  1183.  
  1184.  
  1185.  
  1186.          ──────────────────────────────────────────────────────────────────
  1187.          void HangUp();
  1188.          ──────────────────────────────────────────────────────────────────
  1189.  
  1190.          Hangs up the phone, logging off the user. It is exactly the same
  1191.          as pressing Alt-H.
  1192.  
  1193.  
  1194.  
  1195.          ──────────────────────────────────────────────────────────────────
  1196.          bool CheckAccess(int level,long flags);
  1197.          ──────────────────────────────────────────────────────────────────
  1198.  
  1199.          Checks if the current user can access something that requires
  1200.          <level> and <flags>. Returns TRUE if the user has access, FALSE if
  1201.          not.
  1202.  
  1203.  
  1204.  
  1205.          ──────────────────────────────────────────────────────────────────
  1206.          KEY ScanKey(void);
  1207.          ──────────────────────────────────────────────────────────────────
  1208.  
  1209.          Checks the LOCAL keyboard for a key, and returns the scan code for
  1210.          that key. If no key is available, 0 will be returned.
  1211.  
  1212.          For a list of defined values for scan codes, check the file
  1213.          PB_SDK.H.
  1214.  
  1215.  
  1216.                                       - 21 -
  1217.  
  1218.  
  1219.  
  1220.          ──────────────────────────────────────────────────────────────────
  1221.          bool GetFlag(long flags,char flagchar);
  1222.          void SetFlag(long flags,char flagchar);
  1223.          void ClearFlag(long flags,char flagchar);
  1224.          ──────────────────────────────────────────────────────────────────
  1225.  
  1226.          Access flags are stored in a long integer (32 bits). You have 3
  1227.          macros at your disposal to manipulate access flags:
  1228.  
  1229.             GetFlag   : Returns TRUE if flag <flagchar> is set
  1230.             SetFlag   : Turns flag <flagchar> on
  1231.             ClearFlag : Turns flag <flagchar> off
  1232.  
  1233.          <flagchar> must be a value from 1 to 32. 1-26 correspond to A-Z,
  1234.                     while 27-32 are the same as 1-6.
  1235.  
  1236.  
  1237.  
  1238.          ──────────────────────────────────────────────────────────────────
  1239.          int ErrorLevel(void);
  1240.          ──────────────────────────────────────────────────────────────────
  1241.  
  1242.          Returns the errorlevel of the last executed shell command (Through
  1243.          MenuFunction(MENU_SHELL,...))
  1244.  
  1245.  
  1246.  
  1247.          ──────────────────────────────────────────────────────────────────
  1248.          bool GetIniVar(char *fname,char *varname,char *value,int max);
  1249.          bool SetIniVar(char *fname,char *varname,char *value);
  1250.          ──────────────────────────────────────────────────────────────────
  1251.  
  1252.          These functions can be used to read and write to .INI files. These
  1253.          files are similar to the files used by MS Windows. They can be
  1254.          used to store settings for your application (PEX). An example
  1255.          of a .INI file:
  1256.  
  1257.                DataPath = C:\PB\PEX\MYPEX\DATA
  1258.                ProgPath = C:\PB\PEX\MYPEX
  1259.                MaxUsers = 10
  1260.  
  1261.          This is a standard ASCII file, with each line in the form
  1262.             <varname> = <value>
  1263.  
  1264.          The value of a specific variable can be read by calling the
  1265.          function GetIniVar(). Setting a variable (writing to the .INI file
  1266.          or createing it if it doesn't exist yet) can be done by calling
  1267.          SetIniVar().
  1268.  
  1269.          The parameters for the functions are:
  1270.  
  1271.  
  1272.                                       - 22 -
  1273.  
  1274.  
  1275.  
  1276.              <fname>      Name of the .INI file. The extension of the file
  1277.                           will always be changed to .INI by ProBoard.
  1278.              <varname>    Name of the variable (case INsensitive)
  1279.              <value>      For GetIniVar() : a pointer to a buffer where the
  1280.                                             variable's contents will be
  1281.                                             stored.
  1282.                           For SetIniVar() : a pointer to the value of the
  1283.                                             variable.
  1284.              <max>        Maximum number of characters that can be copied
  1285.                           in <value> (including trailing '\0')
  1286.  
  1287.  
  1288.          Return value: FALSE if the file could not be opened or the
  1289.                        variable does not exist.
  1290.  
  1291.  
  1292.  
  1293.          ──────────────────────────────────────────────────────────────────
  1294.          void exit(void);
  1295.          ──────────────────────────────────────────────────────────────────
  1296.  
  1297.          Exits the current pex-program, and unloads it from memory.
  1298.  
  1299.  
  1300.  
  1301.          ──────────────────────────────────────────────────────────────────
  1302.          void ExitTSR(void);
  1303.          ──────────────────────────────────────────────────────────────────
  1304.  
  1305.          Exits the current pex-program, and leaves it resident. This has
  1306.          some important implications:
  1307.  
  1308.           - All global and static variables keep their values for
  1309.             subsequent executions.
  1310.           - When the same pex-file is run again through menu function 60,
  1311.             the resident copy will be executed. This will result in faster
  1312.             loading.
  1313.           - Any handlers that were installed will be called.
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.                                       - 23 -
  1329.  
  1330.  
  1331.  
  1332.          ──────────────────────────────────────────────────────────────────
  1333.          void InstallHandler(int handler,function);
  1334.          ──────────────────────────────────────────────────────────────────
  1335.  
  1336.          This is probably the most advanced and complicated function in the
  1337.          ProBoard SDK. With this function you can set up a "handler" for a
  1338.          specific action. Right now, only two types of handlers are
  1339.          supported: a replacement for the sysopkey-handler and a handler
  1340.          to intercept loss of carrier. This way you can create your own
  1341.          sysopkeys, or change the behaviour of existing sysopkeys. You could
  1342.          create a handler that intercepts the Alt-J key, and write your own
  1343.          flavor. In future versions you will be able to set up handlers for
  1344.          low-level I/O operations. So you could replace all I/O routines by
  1345.          your own functions. This way you can support your own exotic
  1346.          hardware or something like that. Anything goes!
  1347.  
  1348.             handler   : Handler type. At this time, only HANDLER_SYSOPKEY
  1349.                         and HANDLER_HANGUP are supported.
  1350.             function  : A pointer to the handler function you created.
  1351.  
  1352.          You can install as many handlers as you want.  When the PEX is
  1353.          removed from memory (when the PEX exits), all handlers that were
  1354.          installed will be removed by ProBoard.
  1355.  
  1356.          The handler function is a function that returns an integer. The
  1357.          parameters depend on the type of handler you are creating.
  1358.  
  1359.          For HANDLER_SYSOPKEY the handler function has to be declared like
  1360.          this:
  1361.  
  1362.          int sysopkeyhandler(KEY k)
  1363.          {
  1364.          ...
  1365.          }
  1366.  
  1367.          A sysopkey handler intercepts any special key that is pressed by the
  1368.          sysop. (like F1,Alt-H,...). You can redefine any key, or add your
  1369.          own.
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.                                       - 24 -
  1385.  
  1386.  
  1387.  
  1388.          For HANDLER_HANGUP, the handler functions has to be declared like
  1389.          this:
  1390.  
  1391.          int hanguphandler(void)
  1392.          {
  1393.          ...
  1394.          }
  1395.  
  1396.          The hangup handler works a little different: it is called whenever
  1397.          ProBoard exits (carrier lost, sysop hung up,...). It can be used to
  1398.          perform some cleanup for your running PEX file (like closing
  1399.          files, writing data, etc..). You can install the handler at the
  1400.          start of your program and remove it before the program is
  1401.          finished.
  1402.  
  1403.  
  1404.  
  1405.          If a handler function decides to do anything, it has to return
  1406.          HANDLED. If the handler wants to leave it up to ProBoard, it must
  1407.          return NOT_HANDLED.
  1408.  
  1409.          This asks for an example I suppose:
  1410.  
  1411.          int keyhandler(KEY k)
  1412.          {
  1413.           if(k == KEY_ALTJ)
  1414.             {
  1415.              printf("\7\rHang on %s! I'm shelling to DOS...",UserFirstName);
  1416.              MenuFunction(MENU_SHELL,"*N*Q*X*!");
  1417.              printf("I'm back!!\n");
  1418.  
  1419.              return HANDLED;
  1420.             }
  1421.            else return NOT_HANDLED;
  1422.          }
  1423.  
  1424.          main(int argc,char *argv[])
  1425.          {
  1426.           InstallHandler(HANDLER_SYSOPKEY,keyhandler);
  1427.  
  1428.           ExitTSR();    /* IMPORTANT */
  1429.          }
  1430.  
  1431.          So what does it do?  It intercepts the sysopkey-function, and
  1432.          checks if the key pressed is Alt-J. If it is, it shells to DOS
  1433.          with swapping ON, and it writes its own messages to the screen.
  1434.          When the sysop returns, the handler returns HANDLED to let
  1435.          ProBoard know that it does not have to process the key. You could
  1436.          use this example in an INIT.PEX file.
  1437.          Is this powerful or what?
  1438.  
  1439.  
  1440.                                       - 25 -
  1441.  
  1442.  
  1443.  
  1444.          ──────────────────────────────────────────────────────────────────
  1445.          void RemoveHandler(int handler,function);
  1446.          ──────────────────────────────────────────────────────────────────
  1447.  
  1448.          Removes handler number <handler> which has been installed by
  1449.          InstallHandler().  <function> is the pointer to the handler that
  1450.          should be removed.
  1451.  
  1452.  
  1453.  
  1454.          ──────────────────────────────────────────────────────────────────
  1455.          int ReadHandler(int handler, HANDLER *hnd);
  1456.          ──────────────────────────────────────────────────────────────────
  1457.  
  1458.          Saves all info about a currently installed handler function in a
  1459.          structure. The handler can be restored at a later time by using
  1460.          the function RestoreHandler(). 'handler' is the number of the
  1461.          handler that should be saved, and 'hnd' is a pointer to the
  1462.          structure where the handler function should be saved.
  1463.  
  1464.  
  1465.          ──────────────────────────────────────────────────────────────────
  1466.          long MsgNum(int area, long id)
  1467.          ──────────────────────────────────────────────────────────────────
  1468.  
  1469.          Returns the message number for message 'id', in area 'area'. For
  1470.          Hudson and *.MSG, this is identical to the message id (but DO NOT
  1471.          rely on that).  Returns a value < 1 if there is no message number
  1472.          for 'id'.
  1473.  
  1474.  
  1475.          ──────────────────────────────────────────────────────────────────
  1476.          long MsgId(int area, long n)
  1477.          ──────────────────────────────────────────────────────────────────
  1478.  
  1479.          Returns the message id for message number 'n', in area 'area'. For
  1480.          Hudson and *.MSG, this is identical to the message number (but DO
  1481.          NOT rely on that).  Returns a value < 1 if there is no message
  1482.          number 'n'.
  1483.  
  1484.  
  1485.          ──────────────────────────────────────────────────────────────────
  1486.          long HighMsg(int area)
  1487.          ──────────────────────────────────────────────────────────────────
  1488.  
  1489.          Returns the message id of the last message in the given area.
  1490.          Note: if the lastread pointer is higher than what this function
  1491.          returns, DO NOT use FirstMessage()!  The FirstMessage() function
  1492.          does not support reading past the end of the area. (if you know
  1493.          what I mean :-)
  1494.  
  1495.  
  1496.                                       - 26 -
  1497.  
  1498.  
  1499.  
  1500.          ──────────────────────────────────────────────────────────────────
  1501.          long NumMsgs(int area)
  1502.          ──────────────────────────────────────────────────────────────────
  1503.  
  1504.          Returns the total number of messages in the given area.
  1505.  
  1506.  
  1507.          ──────────────────────────────────────────────────────────────────
  1508.          void LocalDisplay(bool showlocal)
  1509.          ──────────────────────────────────────────────────────────────────
  1510.  
  1511.          Enables/Disables local echo of text.  A parameter of TRUE means
  1512.          "enable local display".  FALSE means "disable local display". See
  1513.          _GRAPH.CPP for an example.
  1514.  
  1515.  
  1516.          ──────────────────────────────────────────────────────────────────
  1517.          void RemoteDisplay(bool showremote)
  1518.          ──────────────────────────────────────────────────────────────────
  1519.  
  1520.          Enables/Disables remote echo of text.  A parameter of TRUE means
  1521.          "enable remote display".  FALSE means "disable remote display".
  1522.          See _GRAPH.CPP for an example.
  1523.  
  1524.  
  1525.          ──────────────────────────────────────────────────────────────────
  1526.          bool RIP()
  1527.          ──────────────────────────────────────────────────────────────────
  1528.  
  1529.          Returns TRUE if RIP was detected and enabled.  FALSE if not...
  1530.  
  1531.  
  1532.          ──────────────────────────────────────────────────────────────────
  1533.          void ShowRIPscrip( char *name )
  1534.          ──────────────────────────────────────────────────────────────────
  1535.  
  1536.          This will send a RIP file located in the RIP directory.  No file
  1537.          extension should be given.  (.RIP is assumed)  The file will not
  1538.          be shown on the local screen.
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.                                       - 27 -
  1553.  
  1554.  
  1555.  
  1556.         ┌──────────────────────────────────────────────────────────────────┐
  1557.         │ Global ProBoard Variables                                        │
  1558.         └──────────────────────────────────────────────────────────────────┘
  1559.  
  1560.          You have access to some important ProBoard system variables
  1561.          through global variables defined in PB_SDK.H.
  1562.  
  1563.  
  1564.  
  1565.          ──────────────────────────────────────────────────────────────────
  1566.          word PBVersion;
  1567.          ──────────────────────────────────────────────────────────────────
  1568.  
  1569.          The version number of ProBoard. The high byte is the major version
  1570.          number (eg. 1). The low byte is the minor version number in
  1571.          hex (eg. 0x30). So if you're using ProBoard v1.30, PBVersion will
  1572.          be set to 0x0130 .
  1573.  
  1574.  
  1575.  
  1576.          ──────────────────────────────────────────────────────────────────
  1577.          word Beta;
  1578.          ──────────────────────────────────────────────────────────────────
  1579.  
  1580.          The beta version number of ProBoard. If this number is 0xFFFF,
  1581.          it means that the release version is running. Beta numbers
  1582.          start from 1.
  1583.          For example, when running ProBoard 1.40 Beta/19, PBVersion will be
  1584.          set to 0x0140, and Beta will be set to 19.
  1585.  
  1586.  
  1587.  
  1588.          ──────────────────────────────────────────────────────────────────
  1589.          long BaudRate
  1590.          ──────────────────────────────────────────────────────────────────
  1591.  
  1592.          The current bps rate of the caller. 0 means local.
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.                                       - 28 -
  1609.  
  1610.  
  1611.  
  1612.          ──────────────────────────────────────────────────────────────────
  1613.          USER_REC * CurUser;
  1614.          ──────────────────────────────────────────────────────────────────
  1615.  
  1616.          Pointer to the current user record. You can change any of the
  1617.          field values in the record, but this will not result in any
  1618.          immediate action by ProBoard. For example, if you change the
  1619.          user's level, ProBoard will not know that you changed it, so you
  1620.          will have to tell it by calling AdjustTime();
  1621.  
  1622.          Check the file PB_SDK.H for a description of the USER_REC
  1623.          structure.
  1624.  
  1625.  
  1626.  
  1627.          ──────────────────────────────────────────────────────────────────
  1628.          int UserRecNr;
  1629.          ──────────────────────────────────────────────────────────────────
  1630.  
  1631.          The record number of the current user's record in the file
  1632.          USERS.BBS, starting from 0. This value cannot be changed.
  1633.  
  1634.  
  1635.  
  1636.          ──────────────────────────────────────────────────────────────────
  1637.          int NumLimits;
  1638.          ──────────────────────────────────────────────────────────────────
  1639.  
  1640.          The number of user levels defined in ProCFG. You can access the
  1641.          limit-values through the global array 'Limits'.  This value
  1642.          cannot be changed.
  1643.  
  1644.  
  1645.  
  1646.          ──────────────────────────────────────────────────────────────────
  1647.          LIMIT * Limits;
  1648.          ──────────────────────────────────────────────────────────────────
  1649.  
  1650.          Is an array of all user levels defined, with download and time
  1651.          limits. Check the file PB_SDK.H for information on the LIMIT
  1652.          structure.
  1653.          You are not allowed to change any values! (A good compiler should
  1654.          generate an error or warning if you try to do so)
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.                                       - 29 -
  1665.  
  1666.  
  1667.  
  1668.          ──────────────────────────────────────────────────────────────────
  1669.          char * LoginDate;
  1670.          char * LoginTime;
  1671.          ──────────────────────────────────────────────────────────────────
  1672.  
  1673.          This is the login date & time of the current user.
  1674.  
  1675.            LoginDate[0] : Day portion of login date
  1676.            LoginDate[1] : Month portion of login date
  1677.            LoginDate[2] : Year portion of login date (00-99)
  1678.            LoginTime[0] : Hour portion of login time
  1679.            LoginTime[1] : Minute portion of login time
  1680.            LoginTime[2] : Second portion of login time
  1681.  
  1682.  
  1683.  
  1684.          ──────────────────────────────────────────────────────────────────
  1685.          bool NetEntered;
  1686.          bool EchoEntered;
  1687.          ──────────────────────────────────────────────────────────────────
  1688.   {}
  1689.          These READ-ONLY variables tell you if netmail and/or echomail has
  1690.          been entered during this session.
  1691.  
  1692.  
  1693.  
  1694.          ──────────────────────────────────────────────────────────────────
  1695.          int NumUsers;
  1696.          ──────────────────────────────────────────────────────────────────
  1697.  
  1698.          This READ-ONLY variable is the number of users currently available
  1699.          in the file USERS.BBS.
  1700.  
  1701.  
  1702.  
  1703.          ──────────────────────────────────────────────────────────────────
  1704.          int NodeNumber;
  1705.          ──────────────────────────────────────────────────────────────────
  1706.  
  1707.          This READ-ONLY variable is the current node number.
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                                       - 30 -
  1721.  
  1722.  
  1723.  
  1724.          ──────────────────────────────────────────────────────────────────
  1725.          char * CurMenu;
  1726.          char * UserFirstname;
  1727.          char * PrevUser;
  1728.          char * StartupPath;
  1729.          char * SysPath;
  1730.          ──────────────────────────────────────────────────────────────────
  1731.  
  1732.          CurMenu       : Current menu name
  1733.          UserFirstName : First name of current user
  1734.          PrevUser      : Name of previous user
  1735.          StartupPath   : Name of the directory where ProBoard was started
  1736.                          from (with trailing '\')
  1737.          SysPath       : Name of the ProBoard system directory (with
  1738.                          trailing '\')
  1739.  
  1740.          These are READ-ONLY strings!
  1741.  
  1742.  
  1743.  
  1744.          ──────────────────────────────────────────────────────────────────
  1745.          CONFIG * Config;
  1746.          ──────────────────────────────────────────────────────────────────
  1747.  
  1748.          A pointer to the current ProBoard configuration structure. See the
  1749.          file PB_SDK.H for a description of the CONFIG structure.
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.                                       - 31 -
  1777.  
  1778.  
  1779.  
  1780.         ┌──────────────────────────────────────────────────────────────────┐
  1781.         │ Special-purpose PEX-files                                        │
  1782.         └──────────────────────────────────────────────────────────────────┘
  1783.  
  1784.          Several pex-files will be loaded automatically (if present). They
  1785.          perform certain actions like edit a message, set up handlers, etc.
  1786.  
  1787.                INIT.PEX      : Will be loaded and executed before any I/O
  1788.                                has been done.  Use this to set up any
  1789.                                handlers (sysopkey handlers, ...)
  1790.  
  1791.                INIT_1.PEX -
  1792.                INIT_9.PEX    : Is the same as INIT.PEX, but will be loaded
  1793.                                in the order of the numbers. So you can have
  1794.                                up to 10 initialization pex-files.
  1795.  
  1796.                LOGIN.PEX     : Is run just before the user is asked for
  1797.                                his/her name.
  1798.  
  1799.                BIRTHDAY.PEX  : Is run after showing NEWS.ANS/ASC if today
  1800.                                is the user's birthday.
  1801.  
  1802.                NEWUSER.PEX   : Is run before the file NEWUSER.A?? is shown.
  1803.  
  1804.                NEWUSER1.PEX  : Is run before the file NEWUSER1.A?? is
  1805.                                shown.
  1806.  
  1807.                NEWUSER2.PEX  : Is run before the file NEWUSER2.ANS/ASC is
  1808.                                shown.
  1809.  
  1810.                WELCOME.PEX   : Is run before the file WELCOME.ANS/ASC is
  1811.                                shown
  1812.  
  1813.                WELCOMEx.PEX  : Is run before the file WELCOMEx.ANS/ASC is
  1814.                                shown (x = 1 to 9)
  1815.  
  1816.                SECxx.PEX     : Executed when a user with security level xx
  1817.                                logs in. Is run before SECxx.ANS/ASC is
  1818.                                shown.
  1819.  
  1820.                EXPIRED.PEX   : Is run before EXPIRED.ANS/ASC is shown, and
  1821.                                after a user's level is lowered because the
  1822.                                subscription date was reached. ProBoard will
  1823.                                send one parameter to this PEX: the original
  1824.                                level, before it was changed by ProBoard.
  1825.  
  1826.                GOODBYE.PEX   : Is run before GOODBYE.ANS is displayed.
  1827.  
  1828.                GOODBYE2.PEX  : Is run after GOODBYE.ANS is displayed.
  1829.  
  1830.  
  1831.  
  1832.                                       - 32 -
  1833.  
  1834.  
  1835.  
  1836.  
  1837.                MSGED.PEX     : Is a replacement of the built-in message
  1838.                                editor. It will be executed with no
  1839.                                parameters. The message that you create has
  1840.                                to be written to a file called MSGTMP.
  1841.                                ProBoard will then read this file and create
  1842.                                a message from it. To let ProBoard know that
  1843.                                the user has aborted a message, delete
  1844.                                MSGTMP.
  1845.  
  1846.                FSED.PEX      : Is similar to MSGED.PEX, but will be
  1847.                                executed if the user has selected the
  1848.                                fullsrceen editor. It works the same way as
  1849.                                MSGED.PEX, but ProBoard will create a MSGTMP
  1850.                                file with the original message if a user is
  1851.                                replying to a message.
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.                                       - 33 -
  1890.